
let db = require('../utils/DB');//数据库
let to = require('../utils/await-to-js');
let { SUCCESS, ERROR } = require('../utils/result');//结果

//热搜关键字
function hotModel() {
    return async (req, res) => {
        let [err, data] = await to(db.query(`SELECT * from search ORDER BY count DESC`));
        err ? ERROR(res, '热搜失败', err) : SUCCESS(res, data);
    }
}

module.exports = hotModel;